#include <iostream>
#include <string>
using namespace std;

string word;
int words[26];

int main(){
	cin>>word;
	for(int a=0;a<word.size();a++){
		words[word[a]-'a']++;
	}
	
	int count=-1,int num=-1;
	for(int a=0;a<26;a++){
		if(words[a]>count){
			count=words[a];
			num=a;
		}
	}
	
	cout<<char('a'+num)<<endl;
	cout<<count<<endl;
	return 0;
} 
